//
//@author jltxseo
// Created by junlintianxia on 2018/7/26.
//
#include <jni.h>
#include <util/ShaderHelper.h>
#include "util/Shader.h"
#include "TutorialLessonTwoNative.h"
#include "TutorialLessonTwo.h"

static TutorialLesson *nativeLesson;
/*
 * Class:     com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative
 * Method:    nativeOnSurfaceCreate
 * Signature: (Landroid/content/res/AssetManager;)V
 */
JNIEXPORT void JNICALL Java_com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative_nativeOnSurfaceCreate
        (JNIEnv *env, jclass jzclass,jobject assetManager)
{
    ShaderHelper::setEnvAndAssetManager(env,assetManager);
    nativeLesson = new TutorialLessonTwo();
    if(nativeLesson != nullptr){
        nativeLesson->create();
    }
}

/*
 * Class:     com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative
 * Method:    nativeOnSurfaceChange
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative_nativeOnSurfaceChange
        (JNIEnv *env, jclass jzclass, jint width, jint height)
{
    if(nativeLesson != nullptr){
        nativeLesson->change(width,height);
    }
}

/*
 * Class:     com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative
 * Method:    nativeOnDrawFrame
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_xq_jltx_learnopenglandroidpro_tutorial_lesson2_TutorialLessonTwoNative_nativeOnDrawFrame
        (JNIEnv *env, jclass jzclass)
{
    if(nativeLesson != nullptr){
        nativeLesson->draw();
    }
}


